package com.gec.zhs.controller;

import java.util.List;

import com.gec.zhs.entity.query.FlowschemeQuery;
import com.gec.zhs.entity.po.Flowscheme;
import com.gec.zhs.entity.vo.ResponseVO;
import com.gec.zhs.service.FlowschemeService;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * 工作流模板信息表 Controller
 */
@RestController("flowschemeController")
@RequestMapping("/flowscheme")
public class FlowschemeController extends ABaseController{

	@Resource
	private FlowschemeService flowschemeService;
	/**
	 * 根据条件分页查询
	 */
	@RequestMapping("/loadDataList")
	public ResponseVO loadDataList(FlowschemeQuery query){
		return getSuccessResponseVO(flowschemeService.findListByPage(query));
	}

	/**
	 * 新增
	 */
	@RequestMapping("/add")
	public ResponseVO add(Flowscheme bean) {
		flowschemeService.add(bean);
		return getSuccessResponseVO(null);
	}

	/**
	 * 批量新增
	 */
	@RequestMapping("/addBatch")
	public ResponseVO addBatch(@RequestBody List<Flowscheme> listBean) {
		flowschemeService.addBatch(listBean);
		return getSuccessResponseVO(null);
	}

	/**
	 * 批量新增/修改
	 */
	@RequestMapping("/addOrUpdateBatch")
	public ResponseVO addOrUpdateBatch(@RequestBody List<Flowscheme> listBean) {
		flowschemeService.addBatch(listBean);
		return getSuccessResponseVO(null);
	}

	/**
	 * 根据Id查询对象
	 */
	@RequestMapping("/getFlowschemeById")
	public ResponseVO getFlowschemeById(String id) {
		return getSuccessResponseVO(flowschemeService.getFlowschemeById(id));
	}

	/**
	 * 根据Id修改对象
	 */
	@RequestMapping("/updateFlowschemeById")
	public ResponseVO updateFlowschemeById(Flowscheme bean,String id) {
		flowschemeService.updateFlowschemeById(bean,id);
		return getSuccessResponseVO(null);
	}

	/**
	 * 根据Id删除
	 */
	@RequestMapping("/deleteFlowschemeById")
	public ResponseVO deleteFlowschemeById(String id) {
		flowschemeService.deleteFlowschemeById(id);
		return getSuccessResponseVO(null);
	}
}